<?php
/** 
 * $Source: /cvsroot/pn-commerce/pn-commerce/pntemplates/plugins/function.pncUserModURL.php,v $
 * $Author: pcornelissen $
 * $Revision: 1.6 $
 * $Date: 2003/12/08 12:09:47 $
 *
 * Type: Function
 *
 * Purpose:  creates a link to a given user  function
 * @param module string, optional, the module for the function, default pncommerce
 * @param type string, optional, the type of the function (user,admin,...), default user
 * @param func, string, the function that should be called
 * @param [rest], optional all additional parameters are included in the URL as parameters
 * @return string, the URL (SSL is used if the admin settings and the function allows it, see admin section for the setting)
 */
function smarty_function_pncUserModURL($params, &$smarty)
{
    pnModLoad('pncommerce','user');
    pnModAPILoad('pncommerce','user');
    $module='pncommerce';
    $type='user';
    extract($params); 
	unset($params['module']);
	unset($params['type']);
	unset($params['func']);
	
    if (!isset($module)) {
        $smarty->trigger_error("pncusermodurl: attribute module required");
        return false;
    }    

    if (!isset($type)) {
        $smarty->trigger_error("pncusermodurl: attribute type required");
        return false;
    }    

    if (!isset($func)) {
        $smarty->trigger_error("pncusermodurl: attribute func required");
        return false;
    }    
    
    return pnVarPrepForDisplay(pnModAPIFunc ('pncommerce', 'user','pncModURL',
								array(
								'Module'=>$module,
								'Section'=>$type,
								'Function'=>$func,
								'Args'=>$params)));        
}
?>
